require 'test/unit'
require 'engine/command'
require 'models/character'
require 'models/room'
require 'models/item'
require 'command/builder'

class Command
    def inform(msg)
        puts msg
    end
end

class BuilderTest < Test::Unit::TestCase
    def setup
        @char = Character.new
        @char.oid = 1
        @char.name = 'Hero'
        CharacterDatabase.instance.add_instance(@char)

        @item = Item.new
        @item.oid = 1
        @item.name = 'Item'
        ItemDatabase.instance.add_instance(@item)

        @room = Room.new
        @room.oid = 1
        @room.name = 'Room'
        RoomDatabase.instance.add(@room)

        @char.room = @room
        @item.room = @room
        @cmd = Builder.new(@char)
    end
    def test_command
        assert_nothing_raised {
            @cmd.execute('in(room): c(Hero).room.characters.each{|d| puts d}')
        }
    end
end
